home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 2
/
SPACE - Library 2 - Volume 1.iso
/
demos
/
275
/
pascal
/
fastread.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-06-25
|
6KB
|
162 lines
PROGRAM F_Read_Test ;
{*************************************************************}
{* Eric's Fast Text Readln *}
{* *}
{* Written by: *}
{* Eric W. Wedaa *}
{* 4620 East 17th Street *}
{* Tucson AZ, 85711 *}
{* *}
{* BIX: EWEDAA *}
{* CIS: 76515,2274 *}
{* *}
{* Release Date: June 20, 1987. *}
{* Second Release Date: Feb. 21, 1988 *}
{* *}
{* Don't let it be said I don't support my users. *}
{* *}
{*************************************************************}
{* *}
{* Written for OSS Pascal Version 1.11 *}
{* GEM/TOS in ROM Version 1.00 *}
{* *}
{* NOT Released in the Public Domain! *}
{* *}
{*************************************************************}
{* *}
{* Design Tools included: *}
{* Eric's Pascal Utilities, *}
{* 1st Word ver 1.03, by GST, *}
{* Alt, By Michtron, *}
{* OSS Pascal, By O.S.S. and C.C.D. *}
{* and, Eric's Library Disk for OSS Pascal. *}
{* *}
{*************************************************************}
{* *}
{* Please remember to include the types and constants that *}
{* are declared in this program. *}
{* *}
{*************************************************************}
CONST
{$i gemconst.pas}
{$I d:\fastread.con}
TYPE
{$I gemtype.pas}
{$I d:\fastread.typ}
VAR
A_File_Name : STRING ; { The file to be opened. }
A_Buffer : Buffer ; { The Fast read buffer. }
Text_Line : Max_String ; { The text line to be read in. }
A_File : TEXT ; { Text file for Pascal comparison. }
X : INTEGER ; { Loop variable. }
Start_Time,
End_Time : LONG_INTEGER ; {Time Variables. }
Count : INTEGER ;
{$I gemsubs.pas}
{$I d:\fastread.inc}
{---------------------------------}
BEGIN ;
WRITELN ('Program starting now.') ;
WRITELN ;
A_File_Name := 'TestDeck.DAT' ;
Text_Line := '11111111111111111111111111111111111111111111111111' ;
{ 12345678901234567890123456789012345678901234567890}
WRITELN ('Writing Pascal test deck now.') ;
Start_Time := CLOCK ;
REWRITE (A_File, A_File_Name) ;
FOR X := 1 TO 1000 DO
WRITELN (A_File, Text_Line) ;
CLOSE (A_File) ;
End_Time := CLOCK ;
WRITELN ('time for Pascal Writeln=', End_Time - Start_Time, ' seconds') ;
WRITELN ;
WRITELN ('Writing Fast test deck now.') ;
Start_Time := CLOCK ;
F_Rewrite (A_Buffer, A_File_Name) ;
WRITELN ('Just called F_Rewrite') ;
FOR X := 1 TO 1000 DO
F_Writeln (A_Buffer, Text_Line) ;
WRITELN ('Calling F_Close') ;
F_Close (A_Buffer) ;
WRITELN ('Just called F_Close') ;
End_Time := CLOCK ;
WRITELN ('Time for Fast Writeln=', End_Time - Start_Time, ' seconds') ;
WRITELN ;
WRITELN ;
WRITELN ('Starting Fast Read now') ;
Start_Time := CLOCK ;
F_Reset (A_Buffer, A_File_Name) ;
IF NOT F_Error (A_Buffer)
THEN
BEGIN ;
Count := 0 ;
WHILE NOT F_Eof (A_Buffer) DO
BEGIN ;
Count := Count + 1 ;
F_Readln (A_Buffer, Text_Line) ;
IF Count > 990
THEN
BEGIN ;
WRITELN (Count) ;
WRITELN (Text_Line) ;
END ;
END ;
IF (F_Rseek (A_Buffer, 0) )
THEN F_Readln (A_Buffer, Text_Line) ;
WRITELN (Text_Line) ;
IF (F_Rseek (A_Buffer, 52) )
THEN F_Readln (A_Buffer, Text_Line) ;
WRITELN (Text_Line) ;
IF (F_Rseek (A_Buffer, 15600) )
THEN F_Readln (A_Buffer, Text_Line) ;
WRITELN (Text_Line) ;
WRITELN (' Fast read done') ;
F_Close (A_Buffer) ;
End_Time := CLOCK ;
WRITELN ('Time for fast read=', End_Time - Start_Time, ' seconds') ;
WRITELN ;
END ;
WRITELN ;
WRITELN ('opening pascal') ;
Start_Time := CLOCK ;
RESET (A_File, A_File_Name) ;
WRITELN ('opened, now reading') ;
WHILE NOT EOF (A_File) DO
BEGIN ;
READLN (A_File, Text_Line) ;
{ writeln(text_line); }
END ;
WRITELN ('done reading') ;
CLOSE (A_File) ;
End_Time := CLOCK ;
WRITELN ('Time for fast read=', End_Time - Start_Time, ' seconds') ;
WRITELN ;
WRITELN ('Pascal closed, Hit return to return to the desktop') ;
READLN (Text_Line) ;
END.